<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GS11 OBU山西发货数据导出</title>
<style type="text/css">
	@import "../dojo-release-1.5.0/dijit/themes/tundra/tundra.css";
	@import "../dojo-release-1.5.0/dojo/resources/dojo.css";
	@import "../dojo-release-1.5.0/dojox/grid/resources/tundraGrid.css";
</style>
<script type="text/javascript" src="../dojo-release-1.5.0/dojo/dojo.js" djConfig="parseOnLoad:true"></script>
<script type="text/javascript" src="../framework/uiutil.js"></script>
<script type="text/javascript">

dojo.require("dojo.io.iframe");

dojo.addOnLoad(function(){
});


function exportExcel(){
	var startCode = dojo.byId("startCode").value;
	var endCode = dojo.byId("endCode").value;

	dijit.byId("exportExcel").setDisabled(true);
	dijit.byId("exportExcel").setLabel('正在生成报表...');

	dojo.xhrPost({
		 url:"../bkgrd/specProductData/exportGs11ShanXiDeliveryData.do",
		 encoding : 'UTF-8',
		 preventCache:true,
		 content:{
			 startCode:startCode,
			 endCode:endCode
		 },
		 handleAs:"text",
		 load:function(response){
			dijit.byId("exportExcel").setLabel('导出Excel');
			dijit.byId("exportExcel").setDisabled(false);
			if(response == ""){
				alert("记录导出失败");
				return;
			}
			downloadFile(response);
		 },
		 error:function(error){
			 alert(error);
			 dijit.byId("exportExcel").setLabel('直接导出Excel');
			 dijit.byId("exportExcel").setDisabled(false);
		 }
	});
}

function downloadFile(filename){
	var exportIframeName = "downloadPdfIframe";
    var iframe = dojo.io.iframe.create(exportIframeName);
    var url = "../bkgrd/downloadFile.do?fileName="+filename;
    dojo.io.iframe.setSrc(iframe, url, true);
}

</script>

<style type="text/css">
#grid{
	border:1px solid #333;
	width:90%;
	margin:10px;
	height:200px;
	font-size:0.9em;
}
</style>
</head>
<body class="tundra">

<h2>GS10 OBU 山西 高速发货数据导出</h2>
<table width="90%">
<tr><td>起始整机镭雕号</td><td><input type="text" dojoType="dijit.form.TextBox" id="startCode" size="30" trim="true" value=""/></td></tr>
<tr><td>结束整机镭雕号</td><td><input type="text" dojoType="dijit.form.TextBox" id="endCode" size="30" trim="true" value=""/></td></tr>
<tr><td colspan="4">
<button dojoType="dijit.form.Button" id="exportExcel" onclick="exportExcel()">导出Excel</button>
</td></tr>
</table>
</body>
</html>